package cn.edu.zjut.mina.bean;

/**
 * 扑克牌类
 */
public class Card implements Comparable<Card> {
	
	/**
	 * 牌的花色   0 方块      1 草花      2  红桃    3黑桃
	 */
	private static final int DIAMOND = 0;//方块
	private static final int CLUB = 1;   //草花
	private static final int HEART = 2;  //红桃
	private static final int SPADE = 3;  //黑桃
	public static final Card[] mCards = {new Card(DIAMOND, 1), new Card(DIAMOND, 2), new Card(DIAMOND, 3), new Card(DIAMOND, 4), new Card(DIAMOND, 5),
		                            new Card(DIAMOND, 6), new Card(DIAMOND, 7), new Card(DIAMOND, 8), new Card(DIAMOND, 9), new Card(DIAMOND, 10),
		                            new Card(DIAMOND, 11), new Card(DIAMOND, 12), new Card(DIAMOND, 13),
		                            new Card(CLUB, 1), new Card(CLUB, 2), new Card(CLUB, 3), new Card(CLUB, 4), new Card(CLUB, 5),
		                            new Card(CLUB, 6), new Card(CLUB, 7), new Card(CLUB, 8), new Card(CLUB, 9), new Card(CLUB, 10),
		                            new Card(CLUB, 11), new Card(CLUB, 12), new Card(CLUB, 13),
		                            new Card(HEART, 1), new Card(HEART, 2), new Card(HEART, 3), new Card(HEART, 4), new Card(HEART, 5),
		                            new Card(HEART, 6), new Card(HEART, 7), new Card(HEART, 8), new Card(HEART, 9), new Card(HEART, 10),
		                            new Card(HEART, 11), new Card(HEART, 12), new Card(HEART, 13),
		                            new Card(SPADE, 1), new Card(SPADE, 2), new Card(SPADE, 3), new Card(SPADE, 4), new Card(SPADE, 5),
		                            new Card(SPADE, 6), new Card(SPADE, 7), new Card(SPADE, 8), new Card(SPADE, 9), new Card(SPADE, 10),
		                            new Card(SPADE, 11), new Card(SPADE, 12), new Card(SPADE, 13)};
	
	private int color;//花色
	private int number;//大小
	public Card(int color, int number) {
		this.setColor(color);
		this.setNumber(number);
	}
	
	public int getColor() {
		return color;
	}
	
	public void setColor(int color) {
		this.color = color;
	}
	
	public int getNumber() {
		return number;
	}
	
	public void setNumber(int number) {
		this.number = number;
	}
	
	public int compareTo(Card o) {//降序排列     先比大小再比颜色
		// TODO Auto-generated method stub
		if (this.number > o.number) {
			return -1;
		} else if (this.number < o.number) {
			return 1;
		} else {
			if (this.color > o.color) {
				return -1;
			} else 
				return 1;
		}
		
	}
}
